<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>

<?php
$_product    = $this->getProduct();
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
?>
<?php if ($_product->isSaleable() && count($_attributes)):?>
    <dl>
    <?php foreach($_attributes as $_attribute): ?>
        <dt><label><?php echo $_attribute->getLabel() ?><span class="required">&nbsp;*</span></label></dt>
        <dd<?php if ($_attribute->decoratedIsLast){?> class="last"<?php }?>>
        <ul class="inline">
        <?php  $options = ( $this->getAttributeOptions( $_attribute ) );?>        
        <?php foreach( $options as $attribute_id => $attribute_data ):?>
        	<?php foreach ($attribute_data['options'] as $_option):?>
        		<?php $powerOption = Mage::getModel("powerattribute/powerattribute")->getPowerOption( $_option['id'] );?> <li>       		
        		<a id="option_<?php echo $attribute_id;?>_<?php echo $_option['id']?>" class="option<?php if( $powerOption ) echo '_'.$powerOption->getData('type');?> super-attribute-area" <?php if( $powerOption && $powerOption->getData('type')=='c' ):?>style="padding:1px;border:1px dashed <?php echo $powerOption->getData('content');?>;"<?php endif;?>>
        			<?php if( !$powerOption ):?><?php echo $_option['label'];?><?php endif;?>
        			<?php if( $powerOption && $powerOption->getData('type')=='f' ):?><img src="<?php echo Mage::getBaseDir().DS.$powerOption->getData('content');?>" id="optionv_<?php echo $attribute_id;?>_<?php echo $_option['id']?>" class="super-attribute-area"><?php endif;?>
        			<?php if( $powerOption && $powerOption->getData('type')=='c' ):?><span style="background:<?php echo $powerOption->getData('content');?>;" id="optionv_<?php echo $attribute_id;?>_<?php echo $_option['id']?>" class="super-attribute-area"><?php echo $_option['label'];?></span><input type="hidden" id="color_<?php echo $attribute_id;?>_<?php echo $_option['id']?>" value="<?php echo $powerOption->getData('content');?>"><?php endif;?>
        		</a>
        		<?php if( $powerOption && $powerOption->getData('type')=='c' ):?>
        		<div class="tooltip" id="tip_<?php echo $attribute_id;?>_<?php echo $_option['id']?>_info" style="position: absolute;display: none;margin-left: 25px;">
                    <ul>
                        <li class="title"><?php echo $_option['label'];?></li>
                        <li style="background-color: <?php echo $powerOption->getData('content');?>;width:100px;height:100px;clear:both;" class="colour">&nbsp;</li>
                    </ul>
                </div>
                <?php elseif( $powerOption && $powerOption->getData('type')=='f' ):?>
        		<div class="tooltip" id="tip_<?php echo $attribute_id;?>_<?php echo $_option['id']?>_info" style="position: absolute;display: none;margin-left: 25px;">
                    <ul>
                        <li class="title"><?php echo $_option['label'];?></li>
                        <li style="background:url( <?php echo Mage::getBaseDir().DS.$powerOption->getData('content');?>);width:100px;height:100px;clear:both;" class="colour">&nbsp;</li>
                    </ul>
                </div>
                <?php endif;?>
        		</li>
        	<?php endforeach;?>
        <?php endforeach;?>
		<?php if( stristr($_attribute->getProductAttribute()->getData('attribute_code'),'size') ):?>
			<li class="sizeguide">
				<a href="<?php ?>"><?php echo $this->__("Size guide");?></a>
			</li>
		<?php endif?>
        <input name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" type="hidden">
        
        <!--
          <select name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="required-entry super-attribute-select">
            <option><?php echo $this->__('Choose an Option...') ?></option>
          </select>
        -->  </ul>
        </dd>
    <?php endforeach; ?>
    </dl>
    
    <?php //$this->getDefaultProductImage('image',500);?>
    <script type="text/javascript">
        var spConfig = new Product.Configpower(<?php echo $this->getJsonPowerConfig() ?>);
        spConfig.setChildProductImages(<?php echo json_encode($this->getChildProductImages('image',272,347));?>);
    </script>
<?php endif;?>
